package top.shiyiri.stringclass;

import org.junit.Test;

/**
 * @author Aunean
 * @date 2022/1/2
 */
public class IDEADebug {

    @Test
    public void StringBufferTest() {
        String str = null;
        StringBuffer sb = new StringBuffer();
        sb.append(str);
        System.out.println(sb.length());//4
        System.out.println(sb);//"null"

        StringBuffer sb2 = new StringBuffer(str);
        System.out.println(sb2);//NullPointerException
    }
}
